package com.example.myapplication01.jetpack.basketball;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.SavedStateViewModelFactory;
import androidx.lifecycle.ViewModelProvider;

import com.example.myapplication01.R;
import com.example.myapplication01.databinding.ActivityBasketballBinding;

public class BasketballActivity extends AppCompatActivity {

    ScoreViewModel scoreViewModel;
    ActivityBasketballBinding binding;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        // setContentView(R.layout.activity_basketball);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_basketball);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.basketball), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        scoreViewModel = new ViewModelProvider(this, new SavedStateViewModelFactory(getApplication(), this)).get(ScoreViewModel.class);
        binding.setData(scoreViewModel);
        binding.setLifecycleOwner(this);
    }

}